home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AOL File Library: 4,401 to 4,500
/
aol-file-protocol-4400-4401-to-4500.zip
/
AOLDLs
/
PDA-Newton Development
/
ND Newt Development Environm
/
newt-devenv-31.sit
/
applic0.nwt
< prev
next >
Wrap
Text File
|
1995-04-05
|
3KB
|
124 lines
Notes
{labels: 'NIL, viewFont: 10241} // nil=Unfiled, or specify a folder, e.g., 'Business. remove viewFont for current Styles default
//ERASE! in order to erase existing entries in this folder first
applic0.nwt -- Slurpee format
4/5/95
Copyright 1994, 1995 S. Weyer. All Rights Reserved Worldwide.
To be distributed only with Newt 2.5 package
A simple introduction to creating applications with Newt. This is a variation
on a version described in article "Building Native Newton Applications with
Newt" in PIE Developers, July 1994. see also NewtATut.
To minimize text entry, use the Slurpee utility and a terminal emulator to
transfer this text file as paragraphs in the Notepad. The folder in 2nd line
is currently set on nil (Unfiled); select same folder in Newt to load.
Tap Expr button, select expression :doObj('add, 'MyApp).
Tap Eval, select MyApp, then select each subsequent object in list
to create application incrementally. See NewtNews.txt. See also NewtATut
----------
MyApp
//:doObj('buildCO,'MyApp)
//:doObj('add,'MyApp)
{_proto: protoApp,
//viewBounds -- defaults to full screen
title: "Hello World",
_package: {
shortTitle: "Hello", // a shorter title for Extras if you install
},
}
----------
MyApp.myInputProto
{_proto: protoInputLine,
text: "",
value: 0,
viewFlags: 10753, //vVisible + vClickable + vGesturesAllowed + vNumbersAllowed,
getTextValue: func() // from text, set number value (used by total)
begin
self.value := StringToNumber(text);
if not value then value := 0;
end,
viewChangedScript: func(slot,view)
if slot='text
then begin
:getTextValue();
if total exists then total:update();
end,
viewSetupFormScript: func()
begin
self.text := clone(text);
:getTextValue();
inherited:?viewSetupFormScript();
end,
}
----------
MyApp+num1
{_proto: myInputProto,
viewBounds: RelBounds(130,20,100,20),
}
----------
MyApp+num2
{_proto: myInputProto,
viewBounds: RelBounds(130,45,100,20),
}
----------
MyApp+total
{_proto: protoStaticText,
viewBounds: RelBounds(130,80,100,16),
text: "Total", // initial text
numVars: ['num1, 'num2],
getValueText: func() // return text from summing field values
begin
local tot := 0, field;
foreach field in numVars // add up num1.value + num2.value etc.
do tot := tot + GetVariable(self,field).value;
if round exists and round.viewValue
then tot := RIntToL(tot);
NumberStr(tot); // return string
end,
update: func()
SetValue(self,'text,:getValueText()),
viewSetupFormScript: func()
begin
self.text := :getValueText();
inherited:?viewSeutpFormScript();
end,
}
----------
MyApp+round
{_proto: protoCheckbox,
viewBounds: RelBounds(20,78,50,16),
text: "Round?",
valueChanged: func()
if total exists then total:update(),
}
---------
MyApp+button
{_proto: protoTextButton,
viewBounds: RelBounds(100,120,40,16),
text: "About",
buttonClickScript: func()
if aboutFloat exists
then aboutFloat:open()
else PlaySound(@102), // ROM_funbeep
}
----------
MyApp+aboutFloat
{_proto: protoFloatNGo,
viewBounds: RelBounds(20,140,150,100),
}
----------
MyApp.aboutFloat+aboutText
{viewclass: clParagraphView,
viewBounds: RelBounds(5,5,140,90),
text: "This demo created by"&&
userConfiguration.name&
", with the help of Newt, the lizard wizard",
viewFlags: 3, //vReadOnly+vVisible,
}
----------
BYE!